/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.trace;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "trace_risk_ctrlassets")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TraceRiskCtrlAssets.findAll", query = "SELECT t FROM TraceRiskCtrlAssets t"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findBySid", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.sid = :sid"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByTraceType", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.traceType = :traceType"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findById", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.id = :id"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByCtrlAssetsCode", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.ctrlAssetsCode = :ctrlAssetsCode"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByObj", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.obj = :obj"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByIsSingleObj", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.isSingleObj = :isSingleObj"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByCalcDirect", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.calcDirect = :calcDirect"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByOwnUserID", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.ownUserID = :ownUserID"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByAlterUserID", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.alterUserID = :alterUserID"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByCreateTime", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.createTime = :createTime"),
    @NamedQuery(name = "TraceRiskCtrlAssets.findByTimeStamp", query = "SELECT t FROM TraceRiskCtrlAssets t WHERE t.timeStamp = :timeStamp")})
public class TraceRiskCtrlAssets implements Serializable {
	public static byte[] EnCode(TraceRiskCtrlAssets msg) throws IOException {
		Codec<TraceRiskCtrlAssets> Lcode = ProtobufProxy.create(TraceRiskCtrlAssets.class);
		return Lcode.encode(msg);
	}
	public static TraceRiskCtrlAssets DeCode(byte[] data) throws IOException {
	Codec<TraceRiskCtrlAssets> Lcode = ProtobufProxy.create(TraceRiskCtrlAssets.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "sid")
    @Protobuf
	private Integer sid;
    @Basic(optional = false)
    @Column(name = "TraceType")
    @Protobuf
	private String traceType;
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private int id;
    @Basic(optional = false)
    @Column(name = "CtrlAssetsCode")
    @Protobuf
	private String ctrlAssetsCode;
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Basic(optional = false)
    @Column(name = "IsSingleObj")
    @Protobuf
	private String isSingleObj;
    @Column(name = "CalcDirect")
    @Protobuf
	private String calcDirect;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public TraceRiskCtrlAssets() {
    }

    public TraceRiskCtrlAssets(Integer sid) {
        this.sid = sid;
    }

    public TraceRiskCtrlAssets(Integer sid, String traceType, int id, String ctrlAssetsCode, String obj, String isSingleObj) {
        this.sid = sid;
        this.traceType = traceType;
        this.id = id;
        this.ctrlAssetsCode = ctrlAssetsCode;
        this.obj = obj;
        this.isSingleObj = isSingleObj;
    }

    public Integer getSid() {
        return sid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public String getTraceType() {
        return traceType;
    }

    public void setTraceType(String traceType) {
        this.traceType = traceType;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCtrlAssetsCode() {
        return ctrlAssetsCode;
    }

    public void setCtrlAssetsCode(String ctrlAssetsCode) {
        this.ctrlAssetsCode = ctrlAssetsCode;
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getIsSingleObj() {
        return isSingleObj;
    }

    public void setIsSingleObj(String isSingleObj) {
        this.isSingleObj = isSingleObj;
    }

    public String getCalcDirect() {
        return calcDirect;
    }

    public void setCalcDirect(String calcDirect) {
        this.calcDirect = calcDirect;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sid != null ? sid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TraceRiskCtrlAssets)) {
            return false;
        }
        TraceRiskCtrlAssets other = (TraceRiskCtrlAssets) object;
        if ((this.sid == null && other.sid != null) || (this.sid != null && !this.sid.equals(other.sid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.trace.TraceRiskCtrlAssets[ sid=" + sid + " ]";
    }
    
}
